package com.itxinyu.src.service.Imp;

import com.itxinyu.src.dao.LoginDao;
import com.itxinyu.src.entity.User;
import com.itxinyu.src.service.Loginservice;

public class LoginserviceImp implements Loginservice {
	private LoginDao ld;
	@Override
	public User login(User u) {
		User exituUser = ld.login(u.getUser_code());
		if (exituUser==null) {
			throw new RuntimeException("账户不存在");
		}
		if (!exituUser.getUser_password().equals(u.getUser_password())) {
			throw new RuntimeException("密码不正确");
		}
		return exituUser;
	}
	public LoginDao getLd() {
		return ld;
	}
	public void setLd(LoginDao ld) {
		this.ld = ld;
	}

}
